from tortoise import fields, models

class EnvParamPrice(models.Model):
    env_param_price_id = fields.IntField(pk=True)
    env_param = fields.ForeignKeyField(
        'models.EnvParameter',
        related_name='env_param_prices',
        on_delete=fields.CASCADE
    )
    price = fields.ForeignKeyField(
        'models.ElectricPriceInfo',
        related_name='env_param_prices',
        on_delete=fields.CASCADE
    )

    class Meta:
        table = "env_param_price"
        unique_together = (("env_param", "price"),)

    def __str__(self):
        return f"EnvParamPrice {self.env_param_price_id}"
